import { defineComponent } from "vue";
import style from "./index.module.less";
import RowView from "../RowView";
import RoundInfo from "../RoundInfo";
import { expertCellProps } from "./types";
import ColView from "../ColView";
import logo from "./asset/logo.png";
import apiTool from "@/command/apiTool";
import TextView from "../TextView";
import CardView from "../CardView";
import { toChatDetail } from "@/command/navigation";
export default defineComponent({
  name: "",
  props: expertCellProps,
  setup(_) {
    return () => {
      const bottomLabel = () => {
        return (
          <ColView>
            <TextView>{_.desc}</TextView>
            <TextView>{_.address}</TextView>
          </ColView>
        );
      };
      return (
        <CardView class="p-[17px]">
          <RowView class="justify-between">
            <RoundInfo
              {..._}
              class="roundinfo-expert"
              v-slots={{ bottomLabel }}
            />
            <ColView class="items-center justify-center">
              <img
                src={_.logo ? _.logo : logo}
                onClick={() => {
                  // apiTool.phoneClick(_.phone)
                  if (_.phone) {
                    toChatDetail({
                      to: _.phone,
                      name: _.title,
                    });
                    return;
                  }
                }}
                class="w-[44px] h-[44px]"
              />
            </ColView>
          </RowView>
        </CardView>
      );
    };
  },
});
